<!DOCTYPE html>
<html lang="en">
<head>
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="yes" name="apple-touch-fullscreen">
    <meta content="telephone=no,email=no" name="format-detection">
    <meta name="wap-font-scale" content="no">
    <meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title><?=$title?></title>
    <link rel="stylesheet" href="/mobile/css/reset.css">
    <link rel="stylesheet" href="/mobile/css/mui.min.css">
    <script src="/mobile/js/flexible_css.debug.js"></script>
    <script src="/mobile/js/flexible.debug.js"></script>
    <link rel="stylesheet" href="/mobile/css/main_train.css">

</head>
<body>
<div id="back-btn-wrap">
    <a class="back-btn" href="javascript:history.go(-1)"></a>考题回顾
</div>

<div v-cloak class="content-main">
    <!--<div class="answer-num-wrap">
        <i class="questions-total fr"></i>
        <i class="questions-cur fr"></i>
    </div>-->
    <section class="questions-wrap choose-wrap rv-wrap">
        <div class="questions-item clearfix">
            <div ><span class="num-now-wrap fl">1、</span></div><p class="question"></p>
        </div>
        <div class="option-item clearfix" style="">
            <span>A</span><p class="option-text"></p>
        </div>
        <div class="option-item clearfix">
            <span>B</span><p class="option-text"></p>
        </div>
        <div class="option-item clearfix">
            <span>C</span><p class="option-text"></p>
        </div>
        <div class="option-item clearfix">
            <span>D</span><p class="option-text"></p>
        </div>
    </section>
    <section class="rv-tips-wrap">
        <p class="rv-tips rv-co"></p>
        <p class="rv-tips rv-my"></p>
        <p class="rv-tips rv-re"></p>
    </section>
    <!--<button id="btn-next" class="btn1" now-page = '1'>下一题</button>
    <button id="btn-exit" class="btn1">退出答题</button>
    <div class="btn-submit-wrap displayNone">
        <button id="btn-submit" class="btn2">提交</button>
    </div>-->

</div>
<script src="/mobile/js/jquery.min.js"></script>
<script src="/mobile/js/common.js"></script>
<script src="/mobile/js/mui.min.js"></script>
<script src="/mobile/js/jrrpc.js"></script>

<script>
    $(function(){
        mui.init();
        var appParam = iService.getAppParam();

        var question_arr = [],
                answers = [],//答案数组
                btn_next = $('#btn-next'),
                nowpage = $(btn_next).attr('now-page'),
                questions_cur = $('.questions-cur'),
                questions_wrap = $('.questions-wrap'),
                questions_total = $('.questions-total'),
                option_item = $('.option-item'),
                btn_submit = $('#btn-submit');

        var questionEq = iService.getQueryString('eq'),
            correctEq = iService.getQueryString('ceq'),
            myEq = iService.getQueryString('meq');

        function getOption(str_arr){
            var arr_option = ['A','B','C','D'];
            var str = '';
            $.each(str_arr,function(e){
                str += arr_option[str_arr[e]-1];
            });
            return str;
        }

        var myEqArr = myEq.split(',');
        var correctEqArr = correctEq.split(',');

        var myEqOption = getOption(myEqArr);
        var correctEqOption = getOption(correctEqArr);



        function getQuestion(page){
            var param = {
                postData:'Question/lists',
                data: {
                    page:1
                }
            };
            $.extend(param.data,appParam);
            $.JsonRpc(param,function(result){
                console.log(result.data.lists[0]);
                var data = result.data.lists[0];
                var que_type = '(单选题)';
                if(data.type==2){
                    que_type = '(多选题)';
                }

                questions_wrap.html(
                        '<div class="questions-item clearfix">'+
                        '<div><span class="num-now-wrap fl">'+page+'、</span></div><p class="question">'+data.topic+'？'+que_type+'</p>'+
                        '</div>'+
                        '<div class="option-item clearfix" style="">'+
                        '<span>A</span><p class="option-text">'+data.option_a+'</p>'+
                        '</div>'+
                        '<div class="option-item clearfix">'+
                        '<span>B</span><p class="option-text">'+data.option_b+'</p>'+
                        '</div>'+
                        '<div class="option-item clearfix">'+
                        '<span>C</span><p class="option-text">'+data.option_c+'</p>'+
                        '</div>'+
                '<div class="option-item clearfix">'+
                '<span>D</span><p class="option-text">'+data.option_d+'</p>'+
                '</div>'
                );

                var optionItemSpan = $('.option-item span');
                $.each(optionItemSpan,function(e){
                    console.log(e);
                    var parentH = $(this).parent('.option-item').height();
                    $(this).css({'height':parentH,'line-height':parentH+'px'});
                });

                var optionItem= $('.option-item');

//                optionItem.eq(correctEq-1).addClass('active');
//                optionItem.eq(correctEq-1).find('span').addClass('active');

                $.each(myEqArr,function(e){
                    if(correctEqArr.indexOf(myEqArr[e])>=0){
                        optionItem.eq(myEqArr[e]-1).addClass('active');
                        optionItem.eq(myEqArr[e]-1).find('span').addClass('active');
                    }else {
                        optionItem.eq(myEqArr[e]-1).addClass('myActive');
                    }
                });



                var rvCo = $('.rv-co'),
                        rvMy = $('.rv-my'),
                        rvRe = $('.rv-re');


                if(correctEq!=myEq){



                    rvRe.html('你答错了');
                }else {
                    rvRe.html('你答对了');
                }




                rvCo.html('正确答案为'+correctEqOption);
                rvMy.html('你选择的选项为'+myEqOption);


                /*correctEq = parseInt(correctEq);
                myEq = parseInt(myEq);
                switch (correctEq){
                    case 1:
                        rvCo.html('正确答案为A');
                        break;
                    case 2:
                        rvCo.html('正确答案为B');
                        break;
                    case 3:
                        rvCo.html('正确答案为C');
                        break;
                }

                switch (myEq){
                    case 1:
                        rvMy.html('你选择的选项为A');
                        break;
                    case 2:
                        rvMy.html('你选择的选项为B');
                        break;
                    case 3:
                        rvMy.html('你选择的选项为C');
                        break;
                }*/



            });
        }

        getQuestion(questionEq);

        $.get('https://www.wzxaini9.cn/api/flow/index/id/11', function (data) {
            console.log($.parseJSON(data));
        })
    });
</script>
</body>
</html>












